package com.pei.Servlet;

import com.alibaba.fastjson.JSON;
import com.pei.Service.Impl.userServiceImpl;
import com.pei.Service.userService;
import com.pei.entity.user;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by dell on 2018/8/10.
 */
@WebServlet(name = "finduserByuidscqServlet")
public class finduserByuidscqServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        userService service=new userServiceImpl();
        request.setCharacterEncoding("utf-8");
        user u= service.finduser(Integer.parseInt(request.getParameter("id")));
        String json= JSON.toJSONString(u);
        out.print(json);
        out.flush();
        out.close();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
